package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-07-25
 * Time: 14:27
 */
class Stu{
    private String name;
    private int age;
    private String StuNum;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getStuNum() {
        return StuNum;
    }

    public void setStuNum(String StuNum) {
        this.StuNum = StuNum;
    }

    public void eat() {
        System.out.println(this.name+" 在吃饭...");
    }
    public void sleep() {
        System.out.println(this.name+" 在睡觉休息。。。");
    }
    public void func1(){
        System.out.println("这个方法是专门为了类内其他方法使用的。");
    }
}
public class Test2 {
//    public static void shoe() {
//        System.out.println("在类内使用静态成员方法，。。。");
//    }
//    public static void main(String[] args) {
//        shoe();
//    }
    public static void main(String[] args) {
        Stu student1 = new Stu();
        //student1.name = "zhangsan"; name 使用了private 进行修饰，不可以在类外直接访问
        student1.setName("小明");
        System.out.println(student1.getName());
        student1.setAge(10);
        System.out.println(student1.getAge());
        student1.setStuNum("1234");
        System.out.println(student1.getStuNum());
    }
}
